import {mapGetters} from 'vuex'
export default {
	computed:{
		...mapGetters('m_cart',['total']),
	},
	//监听器，监听购物车角标
	watch: {
		total() {
			//如果发生变化则重新赋值
			this.setBadge()
		}
	},
	//应用启动,或从后台进入前台显示时触发
	onShow() {
		this.setBadge()
	},
	methods: {
		setBadge(){
			uni.setTabBarBadge({
				index: 2,
				text: this.total + ''
			})
		}
	}
}